﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LF3.Moduls;
using CP.DBService;
using Oracle.ManagedDataAccess.Client;
using System.Data;

namespace LF3.Repositories
{
    public class Lf_Steel_Sample_AnalysisRepository
    {
        DBHelper db = DBHelper.CreateInstance();
        //LF
        public IList<Lf_Steel_Sample_Analysis> GetLFSample(string heatid)
        {
            return db.ExecuteObject<Lf_Steel_Sample_Analysis>(string.Format(@"select * from Lf_Steel_Sample_Analysis 
                                                where heatid = '{0}' and AGGREGATETYPE = '4' and AGGREGATENO=5 
                                                order by INSERT_TIME desc", heatid));
        }
        //BOF
        public IList<Lf_Steel_Sample_Analysis> GetBofSample(string heatid)
        {
            return db.ExecuteObject<Lf_Steel_Sample_Analysis>(string.Format(@"select * from Lf_Steel_Sample_Analysis 
                                                where heatid = '{0}' and AGGREGATETYPE = '3'   
                                                order by INSERT_TIME desc", heatid));
        }

        public DataTable GetHeatID()
        {
            return db.ExecuteDataTable(string.Format(@"select distinct heatid from LF_STEEL_SAMPLE_ANALYSIS order by heatid desc"));
        }

        public IList<Lf_Steel_Sample_Analysis> GetLFSampleCondition(string condition)
        {
            return db.ExecuteObject<Lf_Steel_Sample_Analysis>(string.Format(@"select * from Lf_Steel_Sample_Analysis 
                                                where AGGREGATETYPE = '4' and AGGREGATENO=5 " +
                                                condition +
                                                " order by INSERT_TIME desc"));
        }

    }
}
